#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
    int c, s = 0, x = 0;
    for(int i = 1; i <= 12; i++)
    {
        cin >> c;
        s = s + 300 - c;
        
        if(s < 0)
        {
            printf("-%d", i);
            return 0;
        }

        x += s / 100;
        s %= 100;
    }
    printf("%d", 120 * x + s);
    return 0;
}